package com.atung.parking.controller;

import com.alibaba.fastjson.JSONObject;
import com.atung.parking.service.ParkingSystemService;
import lombok.extern.log4j.Log4j;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/parking/system")
@Log4j2
public class ParkingSystemController {

    @Resource
    private ParkingSystemService parkingSystemService;


    @RequestMapping("/entry/{parkingId}/{carNo}")
    public JSONObject entry(@PathVariable("parkingId") String parkingId,
                            @PathVariable("carNo") String carNo) {

        log.info("========车场记录{}，{}==========",parkingId,carNo);
        JSONObject defaultResult = new JSONObject();
        defaultResult.put("code", 0);
        defaultResult.put("code", 0);
        defaultResult.put("open", 0);
        defaultResult.put("free", 0);
        defaultResult.put("msg", "success");
        // 1. 参数校验
        if (parkingId == null || parkingId.trim().isEmpty() || carNo == null || carNo.trim().isEmpty()) {
            return defaultResult;
        }
        //根据 车场编号还有车牌号判断是否可入场

        return defaultResult;
    }
}
